import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  payAcNo: string;
  payeeAcNo: string;
  outAcNme: string;
  inAcNme: string;
  prodOrdNo: string;
  totalDisctAmt: number;
  payAmt: number;
  txNo: string;
  txTm: string;
  txStatus: string;
  remarks: string;
  refundStatus: boolean;
  txAmt: number;
  refundOrdNo: string
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '商户号',
    hideInTable: true,
    dataIndex: 'metNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '付款会员号',
    hideInTable: true,
    dataIndex: 'memNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易流水号',
    hideInTable: true,
    dataIndex: 'txNo',
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },
  {
    title: '交易状态',
    dataIndex: 'status',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: { text: '成功' },
      1: { text: '失败' },
    },
  },
  {
    title: '有无退款',
    dataIndex: 'refundStatus',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      true: { text: '有' },
      false: { text: '无' }
    },
  },

  // 上方查询，下方表头
  {
    title: '商户名',
    width: 160,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'inAcNme',
    ellipsis: true,
  },
  {
    title: '商户号',
    width: 160,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'metNo',
    ellipsis: true,
  },
  {
    title: '付款会员名',
    width: 160,
    hideInSearch: true,
    dataIndex: 'outAcNme',
    ellipsis: true,
  },
  {
    title: '付款会员号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'memNo',
    ellipsis: true,
  },
  {
    title: '商品订单号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'prodOrdNo',
  },
  {
    title: '订单金额',
    hideInSearch: true,
    dataIndex: 'txAmt',
    width: 120,
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy1',
  },
  {
    title: '折扣金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'totalDisctAmt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy2',
  },
  {
    title: '实付金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'payAmt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy3',
  },
  {
    title: '交易流水号',
    hideInSearch: true,
    dataIndex: 'txNo',
    width: 180,
  },
  {
    title: '交易时间',
    width: 160,
    hideInSearch: true,
    valueType: 'dateTime',
    dataIndex: 'txTm',
  },
  {
    title: '交易结果',
    hideInSearch: true,
    dataIndex: 'txStatus',
    width: 100,
    valueEnum: {
      0: {
        text: '成功',
        status: 'Success',
      },
      1: {
        text: '失败',
        status: 'Error',
      }
    },
  },
  {
    title: '失败原因',
    dataIndex: 'remarks',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '有无退款',
    dataIndex: 'refundStatus',
    hideInSearch: true,
    width: 100,
    valueEnum: {
      true: {
        text: '有',
        status: 'Success',
      },
      false: {
        text: '无',
        status: 'Error',
      }
    },
  },
  {
    title: '操作',
    dataIndex: 'option',
    hideInSearch: true,
    fixed: 'right',
    width: 90
  }
]

// 退款详情表头
let refundColumns = [
  {
    title: '申请日期',
    dataIndex: 'createdTime',
    valueType: 'date',
    width: 160,
    fixed: 'left',
  },
  {
    title: '退款状态',
    dataIndex: 'status',
    width: 100,
    valueEnum: {
      1: {
        text: '失败',
        status: 'Error'
      },
      0: {
        text: '成功',
        status: 'Success'
      }
    },
  },
  {
    title: '退款金额',
    dataIndex: 'refundAmt',
    width: 120,
  },
  {
    title: '币别',
    width: 80,
    dataIndex: 'ccy'
  },
  {
    title: '会员退还折扣',
    width: 120,
    dataIndex: 'memRefundDisc'
  },
  {
    title: '币别',
    width: 80,
    dataIndex: 'ccy'
  },
  {
    title: '平台退还折扣',
    width: 120,
    dataIndex: 'platformRefundDisc'
  },
  {
    title: '币别',
    width: 80,
    dataIndex: 'ccy'
  },
  {
    title: '推荐人退还折扣',
    width: 120,
    dataIndex: 'recRefundDisc'
  },
  {
    title: '币别',
    width: 80,
    dataIndex: 'ccy'
  },
  {
    title: '商户费返还折扣',
    width: 120,
    dataIndex: 'metRefundDisc'
  },
  {
    title: '币别',
    width: 80,
    dataIndex: 'ccy'
  },
  {
    title: '退款流水',
    width: 160,
    dataIndex: 'refundOrdNo'
  },
  {
    title: '退款原因',
    width: 200,
    dataIndex: 'refundReson'
  },
  {
    title: '折扣退还查看',
    dataIndex: 'option',
    fixed: 'right',
    width: 150,
  },
];


export default { columnsData, refundColumns };
